#
# LianHaidong <lianhaidong@gmail.com>
#

include config.mk

Q ?= 1
ifeq ($(Q), 1)
MAKEFLAGS += -s
endif

ifeq ($(OS), Linux)
TOP_DIR = $(shell pwd)
else  #Windows
TOP_DIR = $(shell cd)
endif

INCLUDE_DIR = $(TOP_DIR)/include

CFLAGS += -I$(INCLUDE_DIR)   -Wall 
LD_FLAGS = 

ifeq ($(DEBUG), 1)
CFLAGS += -g -DDEBUG
LD_FLAGS += -g
else
CFLAGS += 
LD_FLAGS += -O3
endif


MYSQL_LDFLAGS = $(shell mysql_config --libs)
LD_FLAGS_EXTRA = -lpthread $(MYSQL_LDFLAGS) -lz -lm


EXE_NAME = gsrv

SUB_DIRS = utils 
OBJS-y = 

ASM_OBJS-y = 


_all : all  $(EXE_NAME)

ifeq ($(DEBUG), 1)
POSTFIX = 
else
POSTFIX = $(STRIP) $@
endif

include rules.mk


$(EXE_NAME) : $(TARGET) main.c
	@echo "-------- BUILD $@"
	$(CC) $^ $(CFLAGS) $(LD_FLAGS) $(LD_FLAGS_EXTRA)  -o $@
	$(POSTFIX)



